package com.itsm.service;

import com.itsm.entity.Approve;
import com.itsm.entity.User;
import com.itsm.service.mapper.ApproveMapper;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ApproveService {
    @Autowired
    private ApproveMapper approveMapper;

    /**
     * 添加审批信息
     * @param approve 审批信息
     */
    public void addApprove(Approve approve){
        approveMapper.insert(approve);
    }

    public Integer updateApprove(Approve approve){
        return  approveMapper.updateById(approve);
    }


    /**
     * 查询部门主管（第二个）的审批
     * @param proNo 单号
     * @param count 第几次审批
     * @param step 第几步
     * @return 审批信息
     */
    public Approve select(String proNo,Integer count,Integer step){
        return approveMapper.select(proNo,count,step);
    }

    /**
     *查询需要几个领导审批
     * @param proNo 工单号
     * @return 数量
     */
    public Integer getCount(String proNo){
        return approveMapper.getCount(proNo);
    }
    /**
     * 获取个人的最新的审批
     * @param processNo 单号
     * @return 审批信息
     */
    public Approve get(String processNo,String name){
        return approveMapper.get(processNo,name);
    }


    public Approve get2(String processNo,String name){
        return approveMapper.get2(processNo,name);
    }

    //查询最新一条审批
    public Approve get1(String processNo){
        return approveMapper.get1(processNo);
    }

    public List<Approve> get3(String processNo){
        return approveMapper.get3(processNo);
    }



}
